//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class Locking
    {
        private bool noAdjustHandles;
        private bool noChangeArrowheads;
        private bool noChangeAspect;
        private bool noChangeShapeType;
        private bool noEditPoints;
        private bool noGrp = false; //\\optional
        private bool noMove;
        private bool noResize;
        private bool noRot;

        private bool noSelect = false;

        public bool NoGrp
        {
            get { return noGrp; }
            set { noGrp = value; }
        }

        public bool NoSelect
        {
            get { return noSelect; }
            set { noSelect = value; }
        }

        public bool NoRot
        {
            get { return noRot; }
            set { noRot = value; }
        }

        public bool NoChangeAspect
        {
            get { return noChangeAspect; }
            set { noChangeAspect = value; }
        }

        public bool NoMove
        {
            get { return noMove; }
            set { noMove = value; }
        }

        public bool NoResize
        {
            get { return noResize; }
            set { noResize = value; }
        }

        public bool NoEditPoints
        {
            get { return noEditPoints; }
            set { noEditPoints = value; }
        }

        public bool NoAdjustHandles
        {
            get { return noAdjustHandles; }
            set { noAdjustHandles = value; }
        }

        public bool NoChangeArrowheads
        {
            get { return noChangeArrowheads; }
            set { noChangeArrowheads = value; }
        }

        public bool NoChangeShapeType
        {
            get { return noChangeShapeType; }
            set { noChangeShapeType = value; }
        }

        protected void ReadAttributes(ReadContext context)
        {
            noAdjustHandles = context.GetOptionalBoolean("noAdjustHandles", false);
            NoChangeArrowheads = context.GetOptionalBoolean("noChangeArrowheads", false);
            NoChangeAspect = context.GetOptionalBoolean("noChangeAspect", false);
            NoChangeShapeType = context.GetOptionalBoolean("noChangeShapeType", false);
            NoEditPoints = context.GetOptionalBoolean("noEditPoints", false);
            NoGrp = context.GetOptionalBoolean("noGrp", false);
            NoMove = context.GetOptionalBoolean("noMove", false);
            NoResize = context.GetOptionalBoolean("noResize", false);
            NoRot = context.GetOptionalBoolean("noRot", false);
            NoSelect = context.GetOptionalBoolean("noSelect", false);
        }

        internal void WriteAttributes(WriteContext context)
        {
            context.SetOptionalBoolean("noAdjustHandles", NoAdjustHandles, false);
            context.SetOptionalBoolean("noChangeAspect", NoChangeAspect, false);
            context.SetOptionalBoolean("noChangeArrowheads", NoChangeArrowheads, false);
            context.SetOptionalBoolean("noChangeShapeType", NoChangeShapeType, false);
            context.SetOptionalBoolean("noEditPoints", NoEditPoints, false);
            context.SetOptionalBoolean("noGrp", NoGrp, false);
            context.SetOptionalBoolean("noMove", NoMove, false);
            context.SetOptionalBoolean("noResize", NoResize, false);
            context.SetOptionalBoolean("noRot", NoRot, false);
            context.SetOptionalBoolean("noSelect", NoSelect, false);
        }
    }
}